package lia.org.service;

import java.util.List;

import lia.org.dao.ModeloDao;
import lia.org.model.Modelo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.googlecode.objectify.Query;

@Service
public class ModeloService {

	@Autowired
	private ModeloDao modeloDao;

	public ModeloDao getModeloDao() {
		return modeloDao;
	}

	public void setModeloDao(ModeloDao modeloDao) {
		this.modeloDao = modeloDao;
	}

	public void add(Modelo modelo) {
		this.modeloDao.add(modelo);
	}

	public Modelo getById(String vin) {
		return this.modeloDao.getByProperty("name", vin);
	}

	public void deleteById(Modelo modelo) {
		this.modeloDao.delete(modelo);
	}

	public List<Modelo> findAll(String filter) {
		Query<Modelo> q = this.modeloDao.listAll();

		return q.list();
	}

}
